/**
 * @Title: KaoQinController.java
 * @Package com.ruoyi.web.controller.kaoqin
 * @Description: 
 * Copyright: Copyright (c) 2019 www.codepeople.cn Inc. All rights reserved. 
 * Website: www.codepeople.cn
 * 注意：本内容仅限于海南科澜技术信息有限公司内部传阅，禁止外泄以及用于其他的商业目 
 * @Author 刘仁
 * @DateTime 2019年5月20日 下午4:42:12
 * @version V1.0
 */

package com.ruoyi.web.controller.supervise.project;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.supervise.domain.CompletionRecordInfo;
import com.ruoyi.supervise.domain.ConsturctionLicenceInfo;
import com.ruoyi.supervise.service.ICompletionRecordInfoService;
import com.ruoyi.supervise.service.IConsturctionLicenceInfoService;

/**
 * @ClassName: projectDoingController
 * @Description: 
 * @Author 吴挺杰
 * @DateTime 2019年11月11日 下午3:53:43
 */
@Controller
@RequestMapping("/project/projectCompleted")
public class projectCompletedController extends BaseController{

	private String prefix = "supervise/project/projectCompleted";
	private String consturctionLicenceInfoPrefix = "supervise/ConsturctionLicenceInfo";
	private String completionRecordInfoprefix = "supervise/CompletionRecord";
	private String surveyResultsPrefix = "supervise/SurveyResults";
	private String constructionDrawingReviewPrefix = "supervise/ConstructionDrawing";
	private String supervisoryInformationPrefix = "supervise/SupervisoryInformation";
	
	@Autowired
    private IConsturctionLicenceInfoService consturctionLicenceInfoService;
	
	@Autowired
    private ICompletionRecordInfoService completionRecordInfoService;
	
	@RequiresPermissions("project:projectCompleted:view")
	@GetMapping()
	public String projectCompleted()
	{
	    return prefix + "/projectCompleted";
	}
	
	 /**
               *  详情
     */
    @GetMapping("/detail")
    public String detail(String name,String company,String price,String area,String address,HttpSession session,ModelMap mmap)
    {
    	session.setAttribute("projectName", name);
    	session.setAttribute("projectCompany", company);
    	session.setAttribute("projectPrice", price);
    	session.setAttribute("projectArea", area);
    	session.setAttribute("projectAddress", address);
    	mmap.put("projectName", name);
    	mmap.put("projectCompany", company);
    	mmap.put("projectPrice", price);
    	mmap.put("projectArea", area);
    	mmap.put("projectAddress", address);
        return prefix + "/projectCompletedDetail";
    }
    
    @PostMapping("/surveyResults")
    @ResponseBody
    public TableDataInfo surveyResults(HttpSession session)
    {
        startPage();
        Map<String,Object> map=new HashMap<String,Object>();
        List<Map> list=new ArrayList<Map>();
        if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
        	map.put("unitengineeringname", "仁恒海棠公园一期（C区）");
        	map.put("Reconnaissanceunit", "海南岩佳勘察设计有限公司");
        	map.put("constructunit", "海南陆侨集团有限公司");
        	map.put("censorship", "海口市秀英区建设工程质量安全监督站");
        	map.put("state", "已上报");
        	list.add(map);
        }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
        {
        	map.put("unitengineeringname", "田德海泉湾A区");
        	map.put("Reconnaissanceunit", "海南岩佳勘察设计有限公司");
        	map.put("constructunit", "海南田德房地产开发有限公司");
        	map.put("censorship", "海口市美兰区建设工程质量安全监督站");
        	map.put("state", "已上报");
        	list.add(map);
        }
        return getDataTable(list);
    }
    
    /**
     *  勘察成果详情
    */
   @GetMapping("/surveyResultsDetail")
   public String surveyResultsDetail(String unitengineeringname,ModelMap mmap)
   {
	if(unitengineeringname.equals("仁恒海棠公园一期（C区）"))
	{
		mmap.put("projectName", "仁恒海棠公园一期（C区）(仁恒海棠公园一期(C区))");
	}else if(unitengineeringname.equals("田德海泉湾A区"))
	{
		mmap.put("projectName", "田德海泉湾A区(一号楼,三号楼,五号楼,七号楼,四号楼,六号楼,九号楼,十号楼,八号楼,农贸超市,地下车库,二号楼)");
	}
   	mmap.put("unitengineeringname", unitengineeringname);
       return surveyResultsPrefix + "/detail";
   }
   
   @PostMapping("/constructionDrawingReview")
   @ResponseBody
   public TableDataInfo constructionDrawingReview(HttpSession session)
   {
       startPage();
       Map<String,Object> map=new HashMap<String,Object>();
       List<Map> list=new ArrayList<Map>();
       if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
       {
       	map.put("unitengineeringname", "仁恒海棠公园一期（C区）");
       	map.put("constructunit", "海南陆侨集团有限公司");
       	map.put("designunit", "广东博意建筑设计院有限公司");
       	map.put("censorship", "海口市秀英区建设工程质量安全监督站");
       	map.put("state", "已上报");
       	list.add(map);
       }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
       {
    	   map.put("unitengineeringname", "田德海泉湾A区");
          	map.put("constructunit", "海南田德房地产开发有限公司");
          	map.put("designunit", "广东博意建筑设计院有限公司");
          	map.put("censorship", "海口市美兰区建设工程质量安全监督站");
          	map.put("state", "已上报");
          	list.add(map);
       }
       return getDataTable(list);
   }
   
   /**
    *  施工图详情
   */
  @GetMapping("/constructionDrawingReviewDetail")
  public String constructionDrawingReviewDetail(String unitengineeringname,ModelMap mmap)
  {
	if(unitengineeringname.equals("仁恒海棠公园一期（C区）"))
	{
		mmap.put("projectName", "仁恒海棠公园一期（C区）(仁恒海棠公园一期(C区))");
	}else if(unitengineeringname.equals("田德海泉湾A区"))
	{
		mmap.put("projectName", "田德海泉湾A区(一号楼,三号楼,五号楼,七号楼,四号楼,六号楼,九号楼,十号楼,八号楼,农贸超市,地下车库,二号楼)");
	}
  	mmap.put("unitengineeringname", unitengineeringname);
      return constructionDrawingReviewPrefix + "/detail";
  }
    
    @PostMapping("/consturctionLicenceInfo")
    @ResponseBody
    public TableDataInfo consturctionLicenceInfo(ConsturctionLicenceInfo consturctionLicenceInfo,HttpSession session)
    {
        startPage();
        if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
        	consturctionLicenceInfo.setProjectinfoguid("1");
        }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
        {
        	consturctionLicenceInfo.setProjectinfoguid("2");
        }else if(session.getAttribute("projectName").equals("海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程"))
        {
        	consturctionLicenceInfo.setProjectinfoguid("3");
        }
        List<ConsturctionLicenceInfo> list = consturctionLicenceInfoService.selectConsturctionLicenceInfoListNew(consturctionLicenceInfo);
        return getDataTable(list);
    }
    
    @PostMapping("/completionRecordInfo")
    @ResponseBody
    public TableDataInfo completionRecordInfo(CompletionRecordInfo completionRecordInfo,HttpSession session)
    {
        startPage();
        if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
        	completionRecordInfo.setProjectinfoguid("1");
        }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
        {
        	completionRecordInfo.setProjectinfoguid("2");
        }else
        {
        	completionRecordInfo.setProjectinfoguid("0");
        }
        List<CompletionRecordInfo> list = completionRecordInfoService.selectCompletionRecordInfoList(completionRecordInfo);
        return getDataTable(list);
    }
    
    /**
	 * 施工许可详情
	*/
	@GetMapping("/consturctionCertInfoDetail")
	public String consturctionCertInfoDetail(String guid, ModelMap mmap,String name)
	{
		ConsturctionLicenceInfo consturctionLicenceInfo = consturctionLicenceInfoService.selectConsturctionLicenceInfoById(guid);
        mmap.put("consturctionLicenceInfo", consturctionLicenceInfo);
        return consturctionLicenceInfoPrefix + "/detail";
	}
	
	 /**
     * 工程竣工验收备案信息详情
     */
    @GetMapping("/completionRecordInfoDetail")
    public String detail(String guid, ModelMap mmap)
    {
        CompletionRecordInfo completionRecordInfo = completionRecordInfoService.selectCompletionRecordInfoById(guid);
        mmap.put("completionRecordInfo", completionRecordInfo);
        return completionRecordInfoprefix + "/detail";
    }
    
    @PostMapping("/supervisoryInformation")
    @ResponseBody
    public TableDataInfo supervisoryInformation(HttpSession session)
    {
        startPage();
        Map<String,Object> map=new HashMap<String,Object>();
        List<Map> list=new ArrayList<Map>();
        if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
        	map.put("name", "仁恒海棠公园一期（C区）(仁恒海棠公园一期(C区))");
        	map.put("unitEngineering", "仁恒海棠公园一期(C区)");
        	map.put("supervisionUnit", "海口市秀英区建设工程质量安全监督站");
        	map.put("status", "监督中");
        	map.put("applicationTime", "2019/6/2");
        	list.add(map);
        }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
        {
        	map.put("name", "田德海泉湾A区项目");
        	map.put("unitEngineering", "六号楼、八号楼、七号楼、九号楼、五号楼、十号楼、农贸超市、四号楼、三号楼、地下车库、一号楼、二号楼");
        	map.put("supervisionUnit", "海口市美兰区建设工程质量安全监督站");
        	map.put("status", "监督中");
        	map.put("applicationTime", "2017/11/17");
        	list.add(map);
        }else if(session.getAttribute("projectName").equals("海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程"))
        {
        	map.put("name", "海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程(海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程)");
        	map.put("unitEngineering", "海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程");
        	map.put("supervisionUnit", "陵水黎族自治县建设工程质量监督站");
        	map.put("status", "监督中");
        	map.put("applicationTime", "2017/3/5");
        	list.add(map);
        }
        return getDataTable(list);
    }
    
    /**
     * 核查信息详情
     */
    @GetMapping("/supervisoryInformationDetail/{name}")
    public String supervisoryInformationDetail(@PathVariable("name") String name, ModelMap mmap,HttpSession session)
    {
    	if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
    		mmap.put("unitName", "仁恒海棠公园一期（C区）(仁恒海棠公园一期(C区)) ");
        }else
        {
        	mmap.put("unitName", "六号楼、八号楼、七号楼、九号楼、五号楼、十号楼、农贸超市、四号楼、三号楼、地下车库、一号楼、二号楼");
        }
        mmap.put("projectName", name);
        
        return supervisoryInformationPrefix + "/SupervisoryInformationDetail";
    }
    
    @PostMapping("/unitEngineering")
    @ResponseBody
    public TableDataInfo unitEngineering(HttpSession session)
    {
        startPage();
        Map<String,Object> map=new HashMap<String,Object>();
        List<Map> list=new ArrayList<Map>();
        if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
        {
        	map.put("name", "仁恒海棠公园一期（C区）");
        	map.put("status", "在建（施工许可（审批通过））");
        	map.put("areaAll", "45555.1");
        	map.put("areaUp", "34147.8");
        	map.put("areaDown", "11407.3");
        	map.put("totalLayer", "26");
        	list.add(map);
        }else if(session.getAttribute("projectName").equals("田德海泉湾A区"))
        {
        	map.put("name", "地下车库");
        	map.put("status", "已竣工备案");
        	map.put("areaAll", "4340.79");
        	map.put("areaUp", "0");
        	map.put("areaDown", "4340.79");
        	map.put("totalLayer", "1");
        	list.add(map);
        }else if(session.getAttribute("projectName").equals("海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程"))
        {
        	map.put("name", "海南清水湾B11-1、B11-2区2栋公寓、4栋高层及地下车库工程");
        	map.put("status", "在建（施工许可（审批通过））");
        	map.put("areaAll", "149618.52");
        	map.put("areaUp", "135897.4");
        	map.put("areaDown", "13721.12");
        	map.put("totalLayer", "26");
        	list.add(map);
        }
        return getDataTable(list);
    }
    
    /**
     *  详情
    */
   @GetMapping("/unit/detail")
   public String unitDetail(String name,HttpSession session,ModelMap mmap)
   {
	   if(session.getAttribute("projectName").equals("仁恒海棠公园一期（C区）"))
	   {
		   mmap.put("unitName", name);
		   return prefix + "/projectCompletedUnitDetail";
	   }else {
		   mmap.put("unitName", name);
		   return prefix + "/projectCompletedUnitDetail";
	   }
	   	
   }
   @GetMapping("/mapproject")
   public String mapproject(String name,String company,String price,String area,String address,HttpSession session,ModelMap mmap)
   {
	    session.setAttribute("projectName", name);
	   	session.setAttribute("projectCompany", company);
	   	session.setAttribute("projectPrice", price);
	   	session.setAttribute("projectArea", area);
	   	session.setAttribute("projectAddress", address);
	   	mmap.put("projectName", name);
	   	mmap.put("projectCompany", company);
	   	mmap.put("projectPrice", price);
	   	mmap.put("projectArea", area);
	   	mmap.put("projectAddress", address);
	   	if(session.getAttribute("projectName").equals("田德海泉湾A区"))
	   	{
	   		mmap.put("areaUp", "0");
	   		mmap.put("areaDown", "4340.79");
	   		mmap.put("totalLayer", "1");
	   		mmap.put("beginTime", "2017/10/26");
	   		mmap.put("endTime", "2018/12/26");
	   		mmap.put("totalDay", "426");
	   		mmap.put("kanchaunit", "海南水文地质工程地质勘察院");
	   		mmap.put("designunit", "广东博意建筑设计院有限公司");
	   		mmap.put("shigongunit", "中天建设集团有限公司");
	   		mmap.put("jianliunit", "广东国晟建设监理有限公司");
	   	}
	    return prefix + "/allproject";
   }
}
